package com.buba.controller;

import com.buba.service.FollowTopicService;
import entity.FollowTopic;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RestController;
import result.CommonResult;

/**
 * @Author: 孔德嘉
 * @Description: TODO关注话题
 * @DateTime: 2023/3/6 17:01
 **/
@RestController
@CrossOrigin
public class FollowTopicController {

    @Autowired
    private FollowTopicService followTopicService;
    /*
    * @param id
    * @return result.CommonResult
    * @author kdj
    * @describe:查询关注的话题
    * @date 2023/3/6 17:02
    */
    @GetMapping("/getFollowTopicList")
    public CommonResult getFollowTopicList(int id){
        return CommonResult.ok(followTopicService.getFollowTopicList(id));
    }
    /*
    * @param topicId 话题id
    * @param userId 用户id
    * @return result.CommonResult
    * @author kdj
    * @describe:修改话题被关注状态
    * @date 2023/3/9 11:52
    */
    @GetMapping("/updateFollowTopicByUserId")
    public CommonResult updateFollowTopicByUserId(int topicId,int userId){
        return CommonResult.ok(followTopicService.updateFollowTopicByUserId(topicId,userId));
    }
}
